package com.faith.timefloating;

import com.faith.timefloating.myutils.Constants;

import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.widget.Toast;

public class MyReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
		if(intent!=null && intent.getAction()!=null && intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)){
			SharedPreferences shared= context.getSharedPreferences(Constants.SHARED_NAME, Activity.MODE_PRIVATE);
			boolean start=shared.getBoolean(Constants.START_ON_BOOT, false);
			if(start){
				Intent _startService=new Intent(context, TimeFloatingService.class);
				context.startService(_startService);
			}
		}
	}

}
